import { useState, useEffect } from "react";

const NowTime = () => {
  const [now, setNow] = useState(new Date().toLocaleTimeString());
  useEffect(() => {
    const timerID = setInterval(() => {
      setNow(new Date().toLocaleTimeString());
    }, 1000);
    return () => clearInterval(timerID);
  });
  return (
    <div
      style={{ color: "white", fontSize: "20px", fontWeight: "700"}}
    >
      {now}
    </div>
  );
};

export default NowTime;
